/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package core;

/**
 *
 * @author ACRCOM
 */
import java.util.LinkedList;
        
public class Truck {
    
    int xtruck, ytruck;
    
    public Truck(int x, int y){
        this.xtruck = x;
        this.ytruck = y;
    }
    
    public boolean isUp(){
        if ((xtruck > 0) && (!mapContent.isRumput(xtruck-1,ytruck)))
            return true;
        else
            return false;
    }
    
    public boolean isDown(){
        if ((xtruck < Map.getMapHeight()-1) && (!mapContent.isRumput(xtruck+1,ytruck)))
            return true;
        else
            return false;
    }
        
    public boolean isLeft(){
        if ((ytruck > 0) && (!mapContent.isRumput(xtruck,ytruck-1)))
            return true;
        else
            return false;
    }
            
    public boolean isRight(){
        if ((ytruck < Map.getMapWidth()-1) && (!mapContent.isRumput(xtruck,ytruck+1)))
            return true;
        else
            return false;
    }
    
    public void goUp(){
        this.xtruck = xtruck-1; 
    }
    
    public void goDown(){
        this.xtruck = xtruck+1;
    }
    
    public void goLeft(){
        this.ytruck = ytruck-1;
    }
    
    public void goRight(){
        this.ytruck = ytruck+1;
    }
        
    public void copyTruck(Truck t){
        t.xtruck = xtruck;
        t.ytruck = ytruck;
    }
    
    public static void main(String[] args){
        Parser.parse("input.txt");
        Map.debugPrint();
        Truck t = new Truck(Map.posPabrik.x,Map.posPabrik.y);
        System.out.println(t.xtruck+","+t.ytruck);
        System.out.println("isup? "+t.isUp());
        System.out.println("isdown? "+t.isDown());
        System.out.println("isleft? "+t.isLeft());
        System.out.println("isright? "+t.isRight());
        //System.out.println(mapContent.isJalan(3,4));        
    }
}
